package com.abk.ets.dao;

// Generated 26 avr. 2013 11:33:47 by Hibernate Tools 3.4.0.CR1

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.abk.ets.data.Administrateur;

/**
 * Home object for domain model class Administrateur.
 * @see com.abk.ets.dao.Administrateur
 * @author Hibernate Tools
 */
@Stateless
public class AdministrateurHome {

	private static final Log log = LogFactory.getLog(AdministrateurHome.class);

	@PersistenceContext
	private EntityManager entityManager;

	public void persist(Administrateur transientInstance) {
		log.debug("persisting Administrateur instance");
		try {
			entityManager.persist(transientInstance);
			log.debug("persist successful");
		} catch (RuntimeException re) {
			log.error("persist failed", re);
			throw re;
		}
	}

	public void remove(Administrateur persistentInstance) {
		log.debug("removing Administrateur instance");
		try {
			entityManager.remove(persistentInstance);
			log.debug("remove successful");
		} catch (RuntimeException re) {
			log.error("remove failed", re);
			throw re;
		}
	}

	public Administrateur merge(Administrateur detachedInstance) {
		log.debug("merging Administrateur instance");
		try {
			Administrateur result = entityManager.merge(detachedInstance);
			log.debug("merge successful");
			return result;
		} catch (RuntimeException re) {
			log.error("merge failed", re);
			throw re;
		}
	}

	public Administrateur findById(int id) {
		log.debug("getting Administrateur instance with id: " + id);
		try {
			Administrateur instance = entityManager.find(Administrateur.class,
					id);
			log.debug("get successful");
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}
}
